home *** CD-ROM | disk | FTP | other *** search
- #! /bin/csh -f
- #
- # $Id: col-script,v 1.6 92/10/27 10:09:46 carlson Exp $
- #
- # col-script Performs a co -l on the file passed and performs a
- # diff on it and the version in ../src/hcrsgi.
- #
- # Added functionality includes:
- # 1. Always performs default options $opt.
- # 2. Performs options found in environment variable RCSOPTS.
- # 3. Passes arguments from command line to co.
- # 4. Compares the file with the version in ../src/hcrsgi.
- # 5. Added option -i skips comparison of files.
- # 6. Performs options found in file .rcsopts.
- #
- # Revision History:
- # $Log: col-script,v $
- # Revision 1.6 92/10/27 10:09:46 carlson
- # When breaking out the options, break out three characters instead of
- # just two to allow checking of just the character following the dash.
- # Remove default options that conflict with command line options.
- #
- # Revision 1.5 92/01/22 15:21:53 carlson
- # No longer set the time of the file to that in the RCS file.
- #
- # Revision 1.4 91/08/27 13:25:56 carlson
- # Fixed problems with handling new .rcsopts file.
- #
- # Revision 1.3 91/08/27 13:11:59 carlson
- # Allow new style .rcsopts files.
- # Added comments.
- #
- # Revision 1.2 91/07/29 09:01:33 chris
- # Cleaned up to use less code. Doesn't separate option from argument
- # anymore and then put them back together.
- # Added RCS symbols.
- #
- #-----------------------------------------------------------------------
- # Set default options for co command here.
- #
- set opt = ( "-l" )
- if ( $?RCSOPTS ) then
- set opt = ( $opt $RCSOPTS )
- endif
- if ( -e ./.rcsopts ) then
- set x = ( `grep "^col[ ]" ./.rcsopts` )
- if ( "$x" == "" ) set x = ( `grep "^co[ ]" ./.rcsopts` )
- if ( $#x > 1 ) then
- set opt = ( $opt $x[2-] )
- else
- set x = ( `cat ./.rcsopts` )
- if ( "$x[1]" != "ci" ) then
- echo "*** Old style .rcsopts file ***"
- set opt = ( $opt `cat ./.rcsopts` )
- endif
- endif
- endif
- set ignore = 0
-
- #----
- # Scan for end of options in parameter list. We need to do this to
- # find where the file names start.
- #
- # While scanning, do the following:
- # 1. Remove any duplicated options from $opt.
- # 2. Check for -i option and set flag to remind us to check the
- # differences in hcrsgi.
- #
- @ first = 1
-
- while ( $first <= $#argv )
- set arg_chars = ( `echo $argv[$first] | sed "s/\(.\)\(.\)\(.\)/\1 \2 \3/\\
- s/\(.\)\(.\)/\1 \2/"` )
- if ( "$arg_chars[1]" != "-" ) break
- if ( "$arg_chars[2]" == "-" ) then
- set argv[$first]
- break
- endif
- @ secnd = 1
- while ( $secnd <= $#opt )
- set opt_chars = ( `echo $opt[$secnd] | sed "s/\(.\)\(.\)\(.\)/\1 \2 \3/\\
- s/\(.\)\(.\)/\1 \2/"` )
- if ( "$opt_chars[1]" != "-" ) break
- if ( "$opt_chars[2]" == "$arg_chars[2]" ) set opt[$secnd]
- if ( "$opt_chars[2]" == "u" && "$arg_chars[2]" == "l" ) \
- set opt[$secnd]
- if ( "$opt_chars[2]" == 'l' && "$arg_chars[2]" == "u" ) \
- set opt[$secnd]
- @ secnd = $secnd + 1
- end
- if ( "$argv[$first]" == "-i" ) then
- set argv[$first]
- set ignore = 1
- endif
- @ first=$first + 1
- end
-
- #----
- # Check out files with arguments passed.
- #
- /usr/sbin/co $opt $argv
- if ( $status != 0 ) exit $status
- if ( $ignore == 1 ) exit 0
-
- #----
- # Compare the differences between this version and the one in
- # ../src/hcrsgi.
- #
- if ( $first >= $#argv ) then
- foreach arg ( $argv )
- echo "----------------------------------$arg"
- /bin/diff $arg ../src/hcrsgi/$arg
- echo "----------------------------------$arg"
- end
- else
- @ first=$first + 1
- foreach arg ( $argv[$first-] )
- echo "----------------------------------$arg"
- /bin/diff $arg ../src/hcrsgi/$arg
- echo "----------------------------------$arg"
- end
- endif
-
- ### Local Variables:
- ### auto-fill-hook: nil
- ### End:
-